﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace CloudClip.LocalFile
{
    public partial class UCLocalFileLogin : UserControl
    {
        public UCLocalFileLogin()
        {
            InitializeComponent();
        }
        
        private void UCLocalFileLogin_Load(object sender, EventArgs e)
        {
            this.txtPath.Text = LocalFileClipProvider.ClipFolderPath;
            checkFolderPath();
        }

        private void btnSelect_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog path = new FolderBrowserDialog();
            path.ShowDialog();
            if (path.SelectedPath != string.Empty)
            {
                this.txtPath.Text = path.SelectedPath;
                LocalFileClipProvider.ClipFolderPath = path.SelectedPath;
            }
            checkFolderPath();
        }

        private void checkFolderPath()
        {
            if (this.txtPath.Text == string.Empty)
            {
                this.txtPath.Text = "請先選擇一個資料夾";
            }
        }
    }
}
